<?php
$stime = microtime(true);
// phpinfo();exit;
try{
	define('N_MYCONF','index');
	include 'core/Init.php';
	$n = new Controller();
	//$d = n_api("debug")->set('dev');	//[0:dev,1:test,2:alpha,3:beta,4:public]
	define('N_APP_TYPE','rpc');

	if(!in_array(N_EVENT,array("rpc")) && N_SCRIPT!='cli'){
		exit("禁止访问！");
	}

	$n->run();
	$all = (microtime(true) - $stime) * 1000;

	if (isset($_POST['sourceId'])){
	        file_put_contents('xxrpc.log', var_export("{$_POST['scode']} : {$_POST['sourceId']} : {$_GET['action']} : $all\n", true), FILE_APPEND);
	}
}catch(CException $c){
	n_fault($c);

}catch(PException $p){
	n_alert($p);

}catch(exception $e){
	n_ufo($e);

}


n_debug();
